<?

session_start();
if (!isset($_SESSION['usuarioLogado']) || ($_SESSION['usuarioLogado'] == false)) {
    header('Location: login.php');
    exit();
}

require_once("classConexaoMysql.php");

Class modulo {

//SELECT GERAL
    function seleciona() {
        $mySQL = new MySQL;
        $rs = $mySQL->executeQuery("SELECT * FROM MODULO ORDER BY DESCRICAO ASC;");
        $mySQL->disconnect;
        return $rs;
    }

    function insere($descricao, $ativo, $idusuario) {
        $mySQL = new MySQL;
        $sql = "INSERT INTO MODULO (DESCRICAO, ATIVO, IDUSUARIO) 
                values ('$descricao', '$ativo', '$idusuario')";
        $rs = $mySQL->executeQuery($sql);
        return $rs;
    }

    function delete($idModulo) {
        $mySQL = new MySQL;
        $sql = "DELETE FROM MODULO WHERE IDMODULO = $idModulo";
        $rs = $mySQL->executeQuery($sql);
        return $rs;
    }
    function contar($idModulo) {
        $mySQL = new MySQL;
        $sql = "SELECT COUNT(*)AS QTD
                FROM ROTINA
                WHERE IDMODULO = $idModulo";
        $rs = $mySQL->executeQuery($sql);
        return $rs;
    }
    

}

?>